home *** CD-ROM | disk | FTP | other *** search
/ Aminet 22 / Aminet 22 (1997)(GTI - Schatztruhe)[!][Dec 1997].iso / Aminet / dev / misc / WHDLoaddev.lha / WHDLoad / Src / sources / blitfix_imm_58a6.s < prev    next >
Text File  |  1997-08-31  |  1KB  |  59 lines

  1. ;*---------------------------------------------------------------------------
  2. ;  :Program.    blitfix_imm_58a6.s
  3. ;  :Contents.    routine to fix program that does not correctly wait for
  4. ;        blitter finish
  5. ;        the instruction which writes the "bltsize" register will be
  6. ;        patched with a routine which will wait for blitter finish
  7. ;        after writing "bltsize"
  8. ;  :History.    30.08.97 extracted from Turrican slave
  9. ;  :Requires.    -
  10. ;  :Copyright.    Public Domain
  11. ;  :Language.    68000 Assembler
  12. ;  :Translator.    Barfly V1.131
  13. ;  :To Do.
  14. ;---------------------------------------------------------------------------*
  15. ;
  16. ; this will patch the following instruction:
  17. ;        move.w    #XXXX,($58,a6)
  18. ;
  19. ; IN:    A0 = APTR start of memory to patch
  20. ;    A1 = APTR end of memory to patch
  21. ;    A2 = APTR space for patch routine MUST be < $8000 !!!
  22. ; OUT:    D0-D1/A0-A1 destroyed
  23.  
  24. _blitfix_imm_58a6
  25.         move.l    a2,-(a7)
  26.     IFD PATCHCOUNT
  27.         clr.w    (6,a2)
  28.     ENDC
  29.  
  30. .loop        cmp.w    #$3d7c,(a0)+        ;move.w #xxxx,($xxxx,a6)
  31.         bne    .next
  32.         cmp.w    #$0058,(2,a0)
  33.         bne    .next
  34.         move.w    (a0),(2,a0)        ;save blitsize
  35.         subq.w    #2,a0
  36.         move.w    #$4eb8,(a0)+        ;JSR $xxxx.w
  37.         move.w    a2,(a0)+
  38.     IFD PATCHCOUNT
  39.         addq.w    #1,(6,a2)
  40.     ENDC
  41. .next        cmp.l    a0,a1
  42.         bhs    .loop
  43.  
  44.         move.w    #$4ef9,(a2)+        ;JMP $xxxxxxxx.l
  45.         lea    .movewait,a0
  46.         move.l    a0,(a2)+
  47.         
  48.         move.l    (a7)+,a2
  49.         rts
  50.  
  51. .movewait    move.l    a0,-(a7)
  52.         move.l    (4,a7),a0
  53.         move.w    (a0)+,($58,a6)
  54.         move.l    a0,(4,a7)
  55.         move.l    (a7)+,a0
  56.         BLITWAIT a6
  57.         rts
  58.  
  59.